<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>电子合同申请</title>

    <!--引入本地 element-ui 的样式，-->
    <link rel="stylesheet" href="/admin/plugin/element-ui/index.css">
    <script type="text/javascript" src="/admin/js-css/js/vue.min.js"></script>
    <script type="text/javascript" src="/admin/plugin/element-ui/index.js"></script>

    <!--    引入Layui组件-->
    <link rel="stylesheet" href="/admin/plugin/layui/dist/css/layui.css" tppabs="http://res.layui.com/layui/dist/css/layui.css"  media="all">
    <script src="/admin/plugin/layui/dist/layui.js" charset="utf-8"></script>

    <script type="text/javascript" src="/admin/js-css/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="/admin/js-css/js/mx1.0.js?v=1.1.1"></script>
    <script type="text/javascript" src="/admin/html/module/yumenyoutian/js/api.js"></script>

    <style>
        .changeLHight .el-form-item__label{
            line-height: 16px !important;
        }
    </style>

</head>
<body>

<div id="app" style="margin-top: 20px;">
    <template>
        <div class="app-container">
            <!-- 头部按钮部分 -->
            <div style="margin-bottom: 10px">
                <el-button type="primary" size="small" @click="addMessage"
                >新增</el-button
                >
                <el-button type="primary" size="small" @click="danjuchexiao"
                >单据撤销</el-button
                >

                <el-button type="success" size="small" v-if="!isdisable" @click="saveForm"
                >保存</el-button
                >
                <el-button
                        type="danger"
                        size="small"
                        v-if="!isdisable"
                        @click="openDelete"
                >删除</el-button
                >
                <el-button
                        size="small"
                        :disabled="!fujian"
                        v-if="!isdisable"
                        @click="openUpLoad"
                >上传附件</el-button
                >
                <el-button
                        size="small"
                        :disabled="!fujian"
                        v-if="!isdisable"
                        @click="openUpLoadBatup"
                >批量上传附件</el-button
                >
                <el-button
                        size="small"
                        :disabled="isprint"
                        v-if="!isdisable"
                        @click="openPrint"
                >打印报销凭证</el-button
                >
                <el-button type="primary" @click="onSubmit" v-if="!isdisable" size="small"
                >发起审核</el-button
                >


                <el-button type="primary" @click="zhengzailuru" v-if="!isdisable" size="small" >正在录入的报销单</el-button>
            </div>



            <!-- 选择特慢病弹窗 -->
            <el-dialog
                    title="选择特慢病信息"
                    top="5vh"
                    width="60%"
                    :visible.sync="tmbVisible"
            >
                <!-- 查询表单 -->
                <el-form
                        :inline="true"
                        size="mini"
                        :model="tmbform"
                        class="demo-form-inline"
                >
                    <el-form-item label="编号">
                        <el-input v-model="tmbform.kaa001" placeholder="编号"></el-input>
                    </el-form-item>
                    <el-form-item label="名称">
                        <el-input v-model="tmbform.kaa002" placeholder="名称"></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="tmbSubmit">查询</el-button>
                    </el-form-item>
                </el-form>
                <!-- 特慢病信息列表 -->
                <TableData
                        ref="tmbTable"
                        :config="tmb_table_config"
                        :chooseRow="choosetmb"
                        :select="funno"
                />
                <!-- 按钮部分 -->
                <div slot="footer" class="dialog-footer">
                    <el-button size="small" @click="closetmblog">取 消</el-button>
                    <el-button size="small" type="primary" @click="toSubmitByjb"
                    >确 定</el-button
                    >
                </div>
            </el-dialog>

            <!-- 上传附件弹窗 -->
            <upload
                    ref="upload"
                    :typeId="1"
                    :visible="upload.visible"
                    :remoteClose="remoteClose"
            />



            <!-- 人员信息录入表单 -->
            <el-form
                    ref="form"
                    inline
                    size="mini"
                    :rules="rules"
                    v-if="!isdisable"
                    :model="form"
                    label-width="125px"
            >
                <el-collapse v-model="activeName">
                    <el-collapse-item name="0">
                        <template slot="title">
                            <b>-- 报销历史记录 --</b>
                        </template>

                        <div>
                            <el-table
                                    :data="tableData_lishi"
                                    ref="tipsTable"
                                    size="mini"
                                    :height="300"
                                    border
                                    style="width: 100%;background: #ecf5ff;">
                                <el-table-column
                                        width="50"
                                        label="操作">
                                    <template slot-scope="scope">
                                        <el-button @click="viewlishi(scope.row)" type="text" size="small">查看</el-button>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="aac003"
                                                 label="姓名"
                                                 :show-overflow-tooltip="true" >
                                </el-table-column>

                                <el-table-column prop="aac002"
                                                 label="身份证号码"
                                                 :show-overflow-tooltip="true" >
                                </el-table-column>

                                <el-table-column prop="aae001"
                                                 label="年度"
                                                 :show-overflow-tooltip="true" >
                                </el-table-column>

                                <el-table-column prop="kni038" width="120"
                                                 label="门诊实际报销金额"
                                                 :show-overflow-tooltip="true" >
                                </el-table-column>
                                <el-table-column prop="kni054"  width="120"
                                                 label="特殊实际报销金额"
                                                 :show-overflow-tooltip="true" >
                                </el-table-column>
                                <el-table-column prop="kni028"  width="120"
                                                 label="住院实际报销金额"
                                                 :show-overflow-tooltip="true" >
                                </el-table-column>


                                <el-table-column prop="kni037"  width="120"
                                                 label="门诊可报销金额"
                                                 :show-overflow-tooltip="true" >
                                </el-table-column>
                                <el-table-column prop="kni053"  width="120"
                                                 label="特殊可报销金额"
                                                 :show-overflow-tooltip="true" >
                                </el-table-column>
                                <el-table-column prop="kni027"  width="120"
                                                 label="住院可报销金额"
                                                 :show-overflow-tooltip="true" >
                                </el-table-column>


                                <el-table-column prop="kni059"
                                                 label="经办日期"
                                                 :show-overflow-tooltip="true" >
                                </el-table-column>

                                <el-table-column prop="kni058"
                                                 label="经办人"
                                                 :show-overflow-tooltip="true" >
                                </el-table-column>
                                <el-table-column prop="aae006"
                                                 label="支付银行账号"
                                                 :show-overflow-tooltip="true" >
                                </el-table-column>
                                <el-table-column prop="aae005"
                                                 label="支付银行名称"
                                                 :show-overflow-tooltip="true" >
                                </el-table-column>




                            </el-table>
                        </div>
                    </el-collapse-item>
                    <el-collapse-item name="1">
                        <template slot="title">
                            <b>-- 人员信息、报销年度、银行信息 --</b>
                        </template>
                        <helpBtn :helpId="1001" />
                        <el-form-item label="序号" prop="aic001">
                            <el-input
                                    v-model="form.aic001"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="单号" prop="knn001">
                            <el-input
                                    v-model="form.knn001"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="年度">
                            <el-select
                                    v-model="form.aae001"
                                    @change="inputChange"
                                    placeholder="请选择年度"
                                    :disabled="isdisable"
                                    class="inputWidth"
                            >
                                <el-option
                                        v-for="item in options.aae001"
                                        :key="item"
                                        :label="item"
                                        :value="item"
                                >
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="所属期" prop="aae002">
                            <el-input
                                    v-model="form.aae002"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="次数" prop="kni012">
                            <el-input
                                    v-model="form.kni012"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="人员类别">
                            <el-select
                                    v-model="form.nka002"
                                    placeholder="请选择人员类别"
                                    class="inputWidth"
                                    disabled
                            >
                                <el-option
                                        v-for="item in options.nka002"
                                        :key="item.aaa102"
                                        :label="item.aaa103"
                                        :value="item.aaa102"
                                >
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="单据类型">
                            <el-select
                                    v-model="form.nka003"
                                    placeholder="请选择单据类型"
                                    class="inputWidth"
                                    disabled
                            >
                                <el-option
                                        v-for="item in options.nka003"
                                        :key="item.aaa102"
                                        :label="item.aaa103"
                                        :value="item.aaa102"
                                >
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="个人编号" prop="aac001">
                            <el-input
                                    v-model="form.aac001"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="亲属编号" prop="pcc001">
                            <el-input
                                    v-model="form.pcc001"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="身份证号码" prop="aac002">
                            <el-input
                                    v-model="form.aac002"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="姓名" prop="aac003">
                            <el-input
                                    v-model="form.aac003"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="性别">
                            <el-select
                                    v-model="form.aac004"
                                    placeholder="请选择性别"
                                    class="inputWidth"
                                    disabled
                            >
                                <el-option
                                        v-for="item in options.aac004"
                                        :key="item.aaa102"
                                        :label="item.aaa103"
                                        :value="item.aaa102"
                                >
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="医保手册号" prop="kcc001">
                            <el-input
                                    v-model="form.kcc001"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="联系方式" prop="aae007">
                            <el-input
                                    v-model="form.aae007"
                                    class="nextInput inputWidth"
                                    @blur="inputChange"
                                    @keyup.enter.native="huiche(0)"
                                    min="0"
                                    :disabled="isdisable"
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="支付银行名称" prop="aae005">
                            <el-select
                                    v-model="form.aae005"
                                    placeholder="请选择支付银行名称"
                                    class="inputWidth"
                            >
                                <el-option
                                        v-for="item in options.aae005"
                                        :key="item.aab340"
                                        :label="item.aab340"
                                        :value="item.aab340"
                                >
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="支付银行账号" prop="aae006">
                            <el-input
                                    v-model="form.aae006"
                                    class="inputWidth"
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="支付方式">
                            <el-select
                                    v-model="form.aae145"
                                    placeholder="请选择支付方式"
                                    class="inputWidth"
                                    :disabled="isdisable"
                            >
                                <el-option
                                        v-for="item in options.aae145"
                                        :key="item.aaa102"
                                        :label="item.aaa103"
                                        :value="item.aaa102"
                                >
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-collapse-item>
                    <el-collapse-item name="2">
                        <template slot="title">
                            <b>-- 基本门诊费信息 --</b>
                        </template>
                        <helpBtn :helpId="1002" />
                        <el-form-item label="附件张数" prop="kni030">
                            <el-input
                                    v-model="form.kni030"
                                    class="nextInput inputWidth"
                                    @blur="inputChange"
                                    @keyup.enter.native="huiche(1)"
                                    
                                    min="0"
                                    :disabled="isdisable"
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="总费用" prop="kni035">
                            <el-input
                                    v-model="form.kni035"
                                    :disabled="isdisable"
                                    @blur="inputChange"
                                    
                                    min="0"
                                    class="nextInput inputWidth"
                                    @keyup.enter.native="huiche(2)"
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="目录外" prop="kni036">
                            <el-input
                                    v-model="form.kni036"
                                    :disabled="isdisable"
                                    @blur="inputChange"
                                    
                                    min="0"
                                    class="nextInput inputWidth"
                                    @keyup.enter.native="huiche(3)"
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="门诊基本医疗报销" prop="knz016">
                            <el-input
                                    v-model="form.knz016"
                                    :disabled="isdisable"
                                    @blur="inputChange"
                                    
                                    min="0"
                                    class="nextInput inputWidth"
                                    @keyup.enter.native="huiche(4)"
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="门诊其他" prop="knz017">
                            <el-input
                                    v-model="form.knz017"
                                    :disabled="isdisable"
                                    @blur="inputChange"
                                    
                                    min="0"
                                    class="nextInput inputWidth"
                                    @keyup.enter.native="huiche(5)"
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="备注" prop="kni039">
                            <el-input
                                    v-model="form.kni039"
                                    class="nextInput inputWidth"
                                    @keyup.enter.native="huiche(6)"
                                    :disabled="isdisable"
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="门诊起伏标准" prop="knz013">
                            <el-input
                                    v-model="form.knz013"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="最高限额" prop="kni033">
                            <el-input
                                    v-model="form.kni033"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="可报金额" prop="kni037">
                            <el-input
                                    v-model="form.kni037"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="报销比例" prop="kni032">
                            <el-input
                                    v-model="form.kni032"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="实际报销金额" prop="kni038">
                            <el-input
                                    v-model="form.kni038"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="累计报销金额" prop="kni034">
                            <el-input
                                    v-model="form.kni034"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                    </el-collapse-item>
                    <el-collapse-item name="3">
                        <template slot="title">
                            <b>-- 特殊门诊费报销信息 --</b>
                        </template>
                        <helpBtn :helpId="1003" />
                        <el-form-item label="特殊病病种" prop="kni043">
                            <el-input
                                    v-model="form.kni043"
                                    placeholder="选择慢(特)病种"
                                    disabled
                                    style="width: 383px"
                            ></el-input>
                            <el-button type="primary" :disabled="isdisable" @click="openTmbGrid"
                            >选择特慢病</el-button
                            >
                        </el-form-item>
                        <el-form-item label="是否重大疾病险">
                            <el-select
                                    v-model="form.knz003"
                                    placeholder="请选择"
                                    :disabled="isdisable"
                                    class="inputWidth"
                            >
                                <el-option
                                        v-for="item in options.aae999"
                                        :key="item.aaa102"
                                        :label="item.aaa103"
                                        :value="item.aaa102"
                                >
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="附件张数" prop="kni041">
                            <el-input
                                    v-model="form.kni041"
                                    class="nextInput inputWidth"
                                    @blur="inputChange"
                                    @keyup.enter.native="huiche(7)"
                                    
                                    min="0"
                                    :disabled="isdisable"
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="总费用" prop="kni047">
                            <el-input
                                    v-model="form.kni047"
                                    :disabled="isdisable"
                                    @blur="inputChange"
                                    
                                    min="0"
                                    class="nextInput inputWidth"
                                    @keyup.enter.native="huiche(8)"
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="目录外" prop="kni048">
                            <el-input
                                    v-model="form.kni048"
                                    :disabled="isdisable"
                                    @blur="inputChange"
                                    
                                    min="0"
                                    class="nextInput inputWidth"
                                    @keyup.enter.native="huiche(9)"
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="基本医疗报销" prop="kni049">
                            <el-input
                                    v-model="form.kni049"
                                    :disabled="isdisable"
                                    @blur="inputChange"
                                    
                                    min="0"
                                    class="nextInput inputWidth"
                                    @keyup.enter.native="huiche(10)"
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="大病报销" prop="kni050">
                            <el-input
                                    v-model="form.kni050"
                                    :disabled="isdisable"
                                    @blur="inputChange"
                                    
                                    min="0"
                                    class="nextInput inputWidth"
                                    @keyup.enter.native="huiche(11)"
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="商业保险报销" prop="kni051">
                            <el-input
                                    v-model="form.kni051"
                                    :disabled="isdisable"
                                    @blur="inputChange"
                                    
                                    min="0"
                                    class="nextInput inputWidth"
                                    @keyup.enter.native="huiche(12)"
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="其他" prop="kni052">
                            <el-input
                                    v-model="form.kni052"
                                    :disabled="isdisable"
                                    @blur="inputChange"
                                    
                                    min="0"
                                    class="nextInput inputWidth"
                                    @keyup.enter.native="huiche(13)"
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="累计报销金额" prop="kni046">
                            <el-input
                                    v-model="form.kni046"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="就医范围">
                            <el-select
                                    v-model="form.nka001"
                                    placeholder="请选择就医范围"
                                    class="inputWidth"
                                    disabled
                            >
                                <el-option
                                        v-for="item in options.nka001"
                                        :key="item.aaa102"
                                        :label="item.aaa103"
                                        :value="item.aaa102"
                                >
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="最高限额" prop="kni045">
                            <el-input
                                    v-model="form.kni045"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="分类">
                            <el-select
                                    v-model="form.kaa003"
                                    placeholder="请选择活动区域"
                                    class="inputWidth"
                                    disabled
                            >
                                <el-option
                                        v-for="item in options.kaa003"
                                        :key="item.kaa003"
                                        :label="item.kaa004"
                                        :value="item.kaa003"
                                >
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="报销比例" prop="kni044">
                            <el-input
                                    v-model="form.kni044"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="可报金额" prop="kni053">
                            <el-input
                                    v-model="form.kni053"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="实际报销金额" prop="kni054">
                            <el-input
                                    v-model="form.kni054"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="总共报销金额" prop="kni055">
                            <el-input
                                    v-model="form.kni055"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="费用结转住院报销" prop="kni057">
                            <el-input
                                    v-model="form.kni057"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="备注" prop="kni056">
                            <el-input
                                    v-model="form.kni056"
                                    class="nextInput inputWidth"
                                    @keyup.enter.native="huiche(14)"
                                    :disabled="isdisable"
                            ></el-input>
                        </el-form-item>
                    </el-collapse-item>
                    <el-collapse-item name="4">
                        <template slot="title">
                            <b>-- 住院基本情况 --</b>
                        </template>
                        <helpBtn :helpId="1004" />
                        <div class="small_line">
                            <b>-- 住院信息 --</b>
                        </div>
                        <el-form-item label="附件张数" prop="kni005">
                            <el-input
                                    v-model="form.kni005"
                                    class="nextInput inputWidth"
                                    @blur="inputChange"
                                    @keyup.enter.native="huiche(15)"
                                    
                                    min="0"
                                    :disabled="isdisable"
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="住院号" prop="kni006">
                            <el-input
                                    v-model="form.kni006"
                                    class="nextInput inputWidth"
                                    @keyup.enter.native="huiche(16)"
                                    :disabled="isdisable"
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="诊断病种" prop="kni007">
                            <el-input
                                    v-model="form.kni007"
                                    class="nextInput inputWidth"
                                    @keyup.enter.native="huiche(17)"
                                    :disabled="isdisable"
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="入院日期">
                            <el-input
                                    v-model="form.kni008"
                                    class="nextInput inputWidth"
                                    @blur="inputChange"
                                    @keyup.enter.native="huiche(18)"
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="出院日期">
                            <el-input
                                    v-model="form.kni009"
                                    class="nextInput inputWidth"
                                    @blur="inputChange"
                                    @keyup.enter.native="huiche(19)"
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="住院天数" prop="kni010">
                            <el-input
                                    v-model="form.kni010"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="住院总费用" prop="kni014">
                            <el-input
                                    v-model="form.kni014"
                                    :disabled="isdisable"
                                    @blur="inputChange"
                                    
                                    min="0"
                                    class="nextInput inputWidth"
                                    @keyup.enter.native="huiche(20)"
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="医院名称" prop="kni013">
                            <el-select
                                    ref="kni013"
                                    v-if="yiyuanshuru"
                                    v-model="form.kni013"
                                    placeholder="请选择医院名称"
                                    class="nextInput inputWidth"
                                    @keyup.enter.native="huiche(21)"
                            >
                                <el-option
                                        v-for="item in options.kni013"
                                        :key="item.akb021"
                                        :label="item.akb021"
                                        :value="item.akb021"
                                >
                                </el-option>
                            </el-select>

                            <el-input
                                    v-else
                                    v-model="form.kni013"
                                    class="nextInput inputWidth"
                                    @keyup.enter.native="huiche(21)"
                                    min="0"
                                    :disabled="isdisable"
                            ></el-input>

                            <el-checkbox v-model="yiyuanshuru" >选择</el-checkbox>

                        </el-form-item>
                        <el-form-item label="起付标准" prop="kni021">
                            <el-input
                                    v-model="form.kni021"
                                    class="nextInput inputWidth"
                                    @keyup.enter.native="huiche(22)"
                                    
                                    min="0"
                                    :disabled="isdisable"
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="本年住院次数" prop="kni011">
                            <el-input
                                    v-model="form.kni011"
                                    class="nextInput inputWidth"
                                    @keyup.enter.native="huiche(23)"
                                    min="0"
                            ></el-input>
                        </el-form-item>
                        <div class="small_line">
                            <b>-- 已报销金额 --</b>
                        </div>
                        <el-form-item label="目录外" prop="kni022">
                            <el-input
                                    v-model="form.kni022"
                                    :disabled="isdisable"
                                    @blur="inputChange"
                                    min="0"
                                    class="nextInput inputWidth"
                                    @keyup.enter.native="huiche(24)"
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="基本医疗报销" prop="kni023">
                            <el-input
                                    v-model="form.kni023"
                                    :disabled="isdisable"
                                    @blur="inputChange"
                                    min="0"
                                    class="nextInput inputWidth"
                                    @keyup.enter.native="huiche(25)"
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="大病报销" prop="kni024">
                            <el-input
                                    v-model="form.kni024"
                                    :disabled="isdisable"
                                    @blur="inputChange"
                                    
                                    min="0"
                                    class="nextInput inputWidth"
                                    @keyup.enter.native="huiche(26)"
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="商业保险报销" prop="kni025">
                            <el-input
                                    v-model="form.kni025"
                                    :disabled="isdisable"
                                    @blur="inputChange"
                                    
                                    min="0"
                                    class="nextInput inputWidth"
                                    @keyup.enter.native="huiche(27)"
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="其他" prop="kni026">
                            <el-input
                                    v-model="form.kni026"
                                    :disabled="isdisable"
                                    @blur="inputChange"
                                    
                                    min="0"
                                    class="nextInput inputWidth"
                                    @keyup.enter.native="huiche(28)"
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="可报金额" prop="kni027">
                            <el-input
                                    v-model="form.kni027"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="实际报销金额" prop="kni028">
                            <el-input
                                    v-model="form.kni028"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="住院报销比例" prop="kni001">
                            <el-input
                                    v-model="form.kni001"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item
                                class="changeLHight"
                                label="住院基本医疗累计报销金额"
                                prop="knz011"
                        >
                            <el-input
                                    v-model="form.knz011"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="住院最高限额" prop="kni002">
                            <el-input
                                    v-model="form.kni002"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="住院累计报销金额" prop="kni003">
                            <el-input
                                    v-model="form.kni003"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="基本医保最高限额" prop="kni004">
                            <el-input
                                    v-model="form.kni004"
                                    class="inputWidth"
                                    disabled
                            ></el-input>
                        </el-form-item>
                        <el-form-item label="备注" prop="kni029">
                            <el-input
                                    v-model="form.kni029"
                                    class="nextInput inputWidth"
                                    @keyup.enter.native="huiche(29)"
                                    :disabled="isdisable"
                            ></el-input>
                        </el-form-item>
                    </el-collapse-item>
                </el-collapse>
            </el-form>
        </div>
    </template>

</div>

<script>

    var vm  = new Vue({
        "el":"#app",
        data() {
            return {
                yiyuanshuru:false,//医院名称是否可以输入
                tableData_lishi:[],//历史报销记录
                activeName: ["1", "2", "3", "4"], // 表单折叠面板
                form: {}, //职工报销录入表单
                options: [], //录入表单中下拉框部分
                isdisable: false, // 禁用所有表单
                rules: {},
                tipsMsg: {},
                tipsMsgArr: [],

                // 选择人员
                choosePerson: {
                    visible: false,
                },

                tmbVisible: false, // 控制选择特慢病信息
                tmbform: {
                    // 特慢病查询表单
                    kaa001: "",
                    kaa002: "",
                },
                tmb_table_config: {
                    checkbox: false,
                    listId: 14, // 14 9
                    sort: "kaa004 asc", // kaa004 asc aac001 asc
                },
                tmbChoose: null, // 特慢病选中

                // 上传附件弹窗
                upload: {
                    visible: false,
                },
                fujian: false, // 上传附件按钮

                // 打印凭证弹窗
                print_config: {
                    visible: false,
                },
                isprint: true,

                // 审核前展示
                printShow_config: {
                    visible: false,
                },
            };
        },
        created() {
            // 判断当前是否有未提交数据
            this.getData();
            // 获取提示信息
            this.getTipsMsg();
        },
        methods: {
            danjuchexiao(){
                let btn = {
                    btn: ['确定', '取消']
                    , yes: async function (index, layero) {
                        //按钮【按钮一】的回调
                        let win = getTopIframe(layero);
                        let data = win.vm.selectData;
                        if(data.length == 0){
                            top.alert("请选择记录");
                            return ;
                        }

                        top.load();
                        let aic001 = data[0]["aic001"];
                        const res = await postWebCustom(getTableId("2044"),{aic001:""+aic001});
                        vm.form = res.data;
                        top.close();
                    }
                    , btn2: function (index, layero) {
                        //按钮【按钮二】的回调
                        //return false 开启该代码可禁止点击该按钮关闭
                    }
                };

                top.f_layer_open_get("/admin/html/dataManagement/list.html?tableId="+getTableId("2043"), "85%", "85%", function () {

                }, btn, "选择待审核的报销单");
            },
            zhengzailuru(){
                let btn = {
                    btn: ['确定', '取消']
                    , yes: async function (index, layero) {
                        //按钮【按钮一】的回调
                        let win = getTopIframe(layero);
                        let data = win.vm.selectData;
                        if(data.length == 0){
                            top.alert("请选择一条记录");
                            return ;
                        }
                        if(data.length>1){
                            top.alert("只能选择一条记录！");
                            return ;
                        }
                        let aic001 = data[0]["aic001"];
                        const res = await postWebCustom(getTableId("2033"),{aic001:""+aic001});
                        vm.form = res.data;
                        vm.inputChange();
                        top.close();
                    }
                    , btn2: function (index, layero) {
                        //按钮【按钮二】的回调
                        //return false 开启该代码可禁止点击该按钮关闭
                    }
                };

                top.f_layer_open_get("/admin/html/dataManagement/list.html?tableId="+getTableId("2031"), "85%", "85%", function () {

                }, btn, "选择正在录入的报销单");
            },
            viewlishi(row){
                let btn = {
                    btn: ['关闭']
                    , btn2: function (index, layero) {
                        //按钮【按钮二】的回调
                        //return false 开启该代码可禁止点击该按钮关闭
                    }
                };
                top.f_layer_open_get("/admin/html/module/yumenyoutian/liuchengshenpi/input_baoxiao.html?id="+row.aic001, "90%", "85%", function () {
                }, btn, "报销数据详情", {});
            },
            huiche(number) {
                if(number == 20 && this.yiyuanshuru){
                    this.$refs.kni013.focus();
                }
                let inputArray = document.getElementsByClassName("nextInput");
                if (number + 1 == inputArray.length) {
                    let now = inputArray[number].childNodes;
                    now[1].blur();
                } else {
                    let nextInput = inputArray[number + 1].childNodes;
                    nextInput[1].focus();
                }
            },
            getTipsMsg() {
                let tips = tipsMsg("116");
                tips.then((result) => {
                    this.tipsMsg = result;
                    for (let key in this.tipsMsg) {
                        this.tipsMsgArr.push(this.tipsMsg[key]);
                    }
                });
            },
            // 发起审核
            async onSubmit() {
                await this.saveForm();
                // 判断是否可以发起审核
                this.$refs.form.validate(async (valid) => {
                    if (valid) {
                        if (
                            this.form.kni038 == 0 &&
                            this.form.kni054 == 0 &&
                            this.form.kni028 == 0
                        ) {
                            this.$message.error(
                                `${this.tipsMsgArr[0].bh}:${this.tipsMsgArr[0].xxnr}`
                            );
                            return;
                        } else {
                            // 判断还有没有验证不通过的
                            const res = await api.postBody(
                                "/admin/api/mirc/MedicalInsuranceReimbursementController/changeEventCall",
                                this.form
                            );
                            if (res.code == 1) {
                                console.log(res.data);
                                if (JSON.stringify(res.data.yz) == "{}") {
                                    // 打开打印展示
                                    this.openPrintShow();
                                } else {
                                    // 数据验证
                                    this.formValidate(res.data);
                                }
                            } else {
                                this.$message.error(res.msg);
                            }
                        }
                    } else {
                        // this.$message.error(
                        //   `${this.tipsMsgArr[1].bh}:${this.tipsMsgArr[1].xxnr}`
                        // );
                        return false;
                    }
                });
            },
            // 提交审核
            async formSubmit() {
                const params = {
                    dataid: this.form.aic001,
                    lcbh: "EmployeeReimbursement",
                };
                let i = top.load();
                // 请求api
                const res = await api.queryBody(
                    "/admin/api/pmc/ProcessManagementController/review",
                    params
                );
                top.layer.close(i);
                if (res.code == 1) {
                    top.layer.closeAll();
                    top.alert(res.msg);
                    setTimeout(() => {
                        vm.getData();
                    }, 500);

                } else {
                    top.alert(res.msg);
                }
            },
            // 获取当前是否有未提交的数据
            async getData() {
                const params = {
                    lx: "1",
                };
                const res = await api.queryBody(
                    "/admin/api/mirc/MedicalInsuranceReimbursementController/queryDefaultData",
                    params
                );
                if (res.code == 1) {
                    if (JSON.stringify(res.data) != "{}") {
                        if (res.data.isdata == 0) {
                            // 如果没有数据-禁用所有输入框
                            this.isdisable = true;
                            this.form = res.data;
                        } else {
                            // 将获取到的数据赋值给录入表单
                            this.form = res.data;
                            this.inputChange();
                            this.tableData_lishi = res.data.listdata_lishi;
                            this.form.listdata_lishi = "";
                            // 判断用户附件张数有没有填写
                            if (this.form.kni030 + this.form.kni041 + this.form.kni005 > 0) {
                                this.fujian = true;
                            } else {
                                this.fujian = false;
                            }
                            // 根据金额判断
                            if (
                                this.form.kni038 == 0 &&
                                this.form.kni054 == 0 &&
                                this.form.kni028 == 0
                            ) {
                                this.isprint = true;
                            } else {
                                this.isprint = false;
                            }

                        }
                        this.options = res.data.options;
                        this.form.options = "";
                    } else {
                        // console.log("当前暂无数据");
                        this.hasNewData = false;
                    }
                } else {
                    this.$message.error(res.msg);
                }
            },
            // 保存数据
            async saveForm() {
                const res = await api.postBody(
                    "/admin/api/mirc/MedicalInsuranceReimbursementController/saveWorker",
                    this.form
                );
                if (res.code == 1) {
                    this.$message.success(res.msg);
                } else {
                    this.$message.error(res.msg);
                }
            },
            // 删除数据
            openDelete() {
                this.$confirm("此操作将永久删除该记录, 是否继续?", "提示", {
                    confirmButtonText: "确定",
                    cancelButtonText: "取消",
                    type: "warning",
                })
                    .then(async () => {
                        const params = {
                            aic001: this.form.aic001,
                        };
                        const res = await api.queryBody(
                            "/admin/api/mirc/MedicalInsuranceReimbursementController/delete",
                            params
                        );
                        if (res.code == 1) {
                            console.log(res);
                            this.$message.success(res.msg);
                            // 删除成功以后刷新表单
                            this.getData();
                        } else {
                            this.$message.error(res.msg);
                        }
                    })
                    .catch(() => {
                        this.$message({
                            type: "info",
                            message: "已取消删除",
                        });
                    });
            },
            // 监听input框
            async inputChange(val) {
                // 判断用户附件张数有没有填写
                if (this.form.kni030 + this.form.kni041 + this.form.kni005 > 0) {
                    this.fujian = true;
                } else {
                    this.fujian = false;
                }
                // 根据金额判断
                if (
                    this.form.kni038 == 0 &&
                    this.form.kni054 == 0 &&
                    this.form.kni028 == 0
                ) {
                    this.isprint = true;
                } else {
                    this.isprint = false;
                }
                const res = await api.postBody(
                    "/admin/api/mirc/MedicalInsuranceReimbursementController/changeEventCall",
                    this.form
                );
                if (res.code == 1) {
                    console.log(res.data);
                    this.form = res.data.dto;
                    // 数据验证
                    this.formValidate(res.data);
                } else {
                    this.$message.error(res.msg);
                }
            },
            // input框验证
            formValidate(data) {
                // 拿到验证返回的数组
                let keys = [];
                let values = [];
                for (let key in data.yz) {
                    keys.push(key);
                    values.push(data.yz[key]);
                }
                console.log("yz:", keys);
                // 判断验证返回的数组长度大于0的话
                if (keys.length > 0) {
                    this.$message.error(data.msg);
                    // 则循环form表单并循环验证表单，进行比对
                    this.$refs.form.clearValidate();
                    this.rules = {};
                    for (let j = 0; j < keys.length; j++) {
                        this.rules[keys[j]] = [
                            { min: 100, message: `${values[j]}`, trigger: "blur" },
                        ];
                        if (keys[j] == "kni043" || keys[j] == "aae007") {
                            this.rules[keys[j]] = [
                                { required: true, message: `${values[j]}`, trigger: "blur" },
                            ];
                        }
                    }
                } else {
                    // 如果验证返回的数组长度==0，则循环form表单数据并将所有设置为通过规则
                    this.$refs.form.clearValidate();
                    this.rules = {};
                }
                setTimeout(() => {
                    this.$refs.form.validate((valid) => {
                        if (valid) {
                            console.log("验证通过");
                        } else {
                            console.log("验证失败");
                            return false;
                        }
                    });
                }, 100);
            },
            // ********************************打印凭证弹窗组件部分******************************* //
            // 打开打印凭证组件
            async openPrint() {
                await this.saveForm();

                let btn = {
                    btn: ['打印预览', '取消']
                    , yes: function (index, layero) {
                        //按钮【按钮一】的回调
                        let win = getTopIframe(layero);
                        win.vm.printHtml();
                    }
                    , btn2: function (index, layero) {
                        //按钮【按钮二】的回调
                        //return false 开启该代码可禁止点击该按钮关闭
                    }
                };

                top.f_layer_open_get("/admin/html/module/yumenyoutian/reimbursement/print_baoxiao.html?id="+vm.form.aic001, "80%", "89%", function () {

                }, btn, "打印报销凭证");
            },
            // 关闭组件
            closePrint() {
                this.print_config.visible = false;
            },
            // 审核前展示
            async openPrintShow() {
                await this.saveForm();
                let btn = {
                    btn: ['提交审核', '取消']
                    , yes: function (index, layero) {
                        //按钮【按钮一】的回调
                        let win = getTopIframe(layero);
                        vm.formSubmit();
                    }
                    , btn2: function (index, layero) {
                        //按钮【按钮二】的回调
                        //return false 开启该代码可禁止点击该按钮关闭
                    }
                };

                top.f_layer_open_get("/admin/html/module/yumenyoutian/reimbursement/print_baoxiao.html?id="+vm.form.aic001, "80%", "89%", function () {

                }, btn, "提交审核");
            },
            closePrintShow() {
                this.printShow_config.visible = false;
            },

            openUpLoadBatup(){
                let btn = {
                    btn: ['取消']
                    , btn2: function (index, layero) {
                        //按钮【按钮二】的回调
                        //return false 开启该代码可禁止点击该按钮关闭
                    }
                };

                top.f_layer_open_get("/admin/html/module/yumenyoutian/reimbursement/upload_local.html?dataid="+this.form.aic001+"&type=1", "80%", "87%", function () {

                }, btn, "批量上传附件")
            },
            // ********************************上传附件弹窗部分******************************* //
            // 打开上传附件弹窗
            async openUpLoad() {
                let btn = {
                    btn: ['取消']
                    , btn2: function (index, layero) {
                        //按钮【按钮二】的回调
                        //return false 开启该代码可禁止点击该按钮关闭
                    }
                };

                top.f_layer_open_get("/admin/html/module/yumenyoutian/reimbursement/upload.html?dataid="+this.form.aic001+"&typeId=1", "59%", "60%", function () {

                }, btn, "上传附件")
            },
            // 关闭弹窗-通用
            remoteClose() {
                this.upload.visible = false;
                this.choosePerson.visible = false;
            },
            async isSelectPonse(){
                load();
                let res1 = await api.queryBody("/admin/api/mirc/MedicalInsuranceReimbursementController/queryDefualtdataShangci",{lx:"1"});
                layer.closeAll();
                if(res1.code == 0){
                    return false;
                }
                let _this = this;
                this.$confirm("是否选择 "+res1.data.aac003+" 进行录入报销单?", '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(async () => {

                    load();
                    const params = {
                        aac001: res1.data.aac001,
                    };
                    const res = await api.postBody(
                        "/admin/api/mirc/MedicalInsuranceReimbursementController/calculateWorkerReimbursementAmount",
                        params
                    );
                    layer.closeAll();
                    if (res.code == 1) {
                        _this.form = res.data;
                        _this.isdisable = false;
                        _this.getData();
                        _this.$message.success("选择成功");
                    } else {
                        _this.$message.error(res.msg);
                    }

                }).catch(() => {
                    _this.addMessageSelect();
                });
                return true;
            },
            // ********************************个人信息弹窗部分******************************* //
            // 点击新增按钮去选择报销人员信息
            async addMessage() {
                let thn = await this.isSelectPonse();
                if(!thn){
                    this.addMessageSelect();
                }

            },
            addMessageSelect(){
                let _this = this;
                let btn = {
                    btn: ['确定', '取消']
                    , yes: async function (index, layero) {
                        //按钮【按钮一】的回调
                        let win = getTopIframe(layero);
                        let data = win.vm.selectData;
                        if(data.length>1){
                            top.alert("只能选择一条记录进行操作！");
                            return;
                        }
                        if(data.length == 0){
                            top.alert("请选择一条记录进行操作！");
                            return;
                        }
                        top.load();
                        const params = {
                            aac001: data[0].aac001,
                        };
                        const res = await api.postBody(
                            "/admin/api/mirc/MedicalInsuranceReimbursementController/calculateWorkerReimbursementAmount",
                            params
                        );
                        if (res.code == 1) {
                            _this.form = res.data;
                            _this.isdisable = false;
                            _this.getData();
                            _this.$message.success("选择成功");
                        } else {
                            _this.$message.error(res.msg);
                        }
                        top.layer.closeAll();
                    }
                    , btn2: function (index, layero) {
                        //按钮【按钮二】的回调
                        //return false 开启该代码可禁止点击该按钮关闭
                    }
                };

                top.f_layer_open_get("/admin/html/dataManagement/list.html?tableId="+getTableId("9"), "90%", "85%", function () {

                }, btn, "选择个人基本信息");
            },
            // 根据选中信息获取用户报销数据
            chooseWorker(data) {
                this.$message.success("选择成功");
                this.choosePerson.visible = false;
                this.form = data;
                this.isdisable = false;
            },
            funno(){},

            // ********************************特慢病弹窗部分******************************* //
            // 打开特慢病弹窗-获取特慢病信息列表
            openTmbGrid() {
                let btn = {
                    btn: ['确定', '取消']
                    , yes: function (index, layero) {
                        //按钮【按钮一】的回调
                        let win = getTopIframe(layero);
                        let data = win.vm.selectData;
                        if(data.length == 0){
                            top.alert("请选择一条记录");
                            return ;
                        }
                        if(data.length>1){
                            top.alert("只能选择一条记录！");
                            return ;
                        }
                        vm.toSubmitByjb(data);
                    }
                    , btn2: function (index, layero) {
                        //按钮【按钮二】的回调
                        //return false 开启该代码可禁止点击该按钮关闭
                    }
                };

                top.f_layer_open_get("/admin/html/dataManagement/list.html?tableId="+getTableId("14"), "60%", "60%", function () {

                }, btn, "选择特慢病")
            },
            // 特慢病病种查询
            tmbSubmit() {
                const query = queryList(this.tmbform);
                if (query != false) {
                    //   调用子组件中的方法
                    this.$refs.tmbTable.getDataList(query);
                    this.$message.success("查询成功");
                } else {
                    this.$refs.tmbTable.getDataList();
                }
            },
            // 选择某种特慢病
            choosetmb(val) {
                console.log(val);
                this.tmbChoose = val;
            },
            closetmblog() {
                this.tmbVisible = false;
                this.tmbform = {
                    kaa001: "",
                    kaa002: "",
                };
            },
            async toSubmitByjb(data) {
                // 向后台发送请求
                const params = {
                    jb: data[0].kaa004,
                    nd: ""+this.form.aae001
                };
                top.load();
                const res = await api.queryBody(
                    "/admin/api/mirc/MedicalInsuranceReimbursementController/chooseAslowDisease",
                    params
                );
                top.layer.closeAll();
                // 请求成功后关闭弹窗
                if (res.code == 1) {
                    console.log(res.data);
                    this.$message.success("选择成功");
                    this.form.kni043 = data[0].kaa002;
                    this.form.kaa003 = res.data.kaa003;
                    this.form.kni045 = res.data.kaa005;
                    this.inputChange();
                } else {
                    this.$message.error(res.msg);
                }
            },
        },
        watch:{
            "form.kni008":function (v){
                if(v!=undefined && v.length == 8 && v.indexOf("-")==-1){
                    let dstr = v.substring(0,4)+"-"+v.substring(4,6)+"-"+v.substring(6,8);
                    this.form.kni008 = dstr;
                }
            },
            "form.kni009":function (v){
                if(v!=undefined && v.length == 8 && v.indexOf("-")==-1){
                    let dstr = v.substring(0,4)+"-"+v.substring(4,6)+"-"+v.substring(6,8);
                    this.form.kni009 = dstr;
                }
            }
        }
    })

</script>
<style lang="scss" scoped>
    .line {
        text-align: center;
    }
    .small_line {
        margin-bottom: 10px;
        padding: 10px 0 0 20px;
        color: #666;
        font-size: 14px;
    }
    .inputWidth {
        width: 170px;
    }
</style>


</body>
</html>